package com.canpany.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.canpany.dao.DoLink;
import com.canpany.vo.News;


import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.canpany.dao.DoLink;

public class AddNews extends HttpServlet {

	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		response.setContentType("text/html;charset=gbk");
		PrintWriter out=response.getWriter();
			String title = request.getParameter("title");
			String content = request.getParameter("content");
			News news = new News();
			news.setTitle(title);
			news.setContent(content);
			DoLink dao=new DoLink();
			dao.insertNews(title, content);
			response.sendRedirect("admin/manageNews.jsp");		
	}
		
		
		

	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}
	
	
}


